<%= form_for(@user) do |f| %>
  <% if @user.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@user.errors.count, "error") %> prohibe este usuario de ser guradado:</h2>

      <ul>
      <% @user.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>
  <p>
    <%= f.label :email,"Correo Electrónico" %><br />
    <%= f.text_field :email %>
  </p>
  <div class="field">
    <%= f.label :name,"Nombre" %><br />
    <%= f.text_field :name %>
  </div>
  <div class="field">
    <%= f.label :last_name,"Apellido" %><br />
    <%= f.text_field :last_name %>
  </div>
  <div class="field">
    <%= f.label :nickname, "Alias" %><br />
    <%= f.text_field :nickname %>
  </div>
  <div class="field">
    <%= f.label :rut %><br />
    <%= f.text_field :rut %>
  </div>
  <div class="field">
    <%= f.label :born %><br />
    <%= f.date_select :born %>
  </div>
  <p>
    <%= f.label :password,"Contraseña" %><br />
    <%= f.password_field :password %>
  </p>
  <p>
    <%= f.label :password_confirmation,"Confirme contraseña" %><br />
    <%= f.password_field :password_confirmation %>
  </p>
  <%if current_user.priority? >= 2 and current_user.id != params[:id].to_i %>
  <p>
    <%= f.label :priority, "Prioridad" %><br />
    <%= f.select (:priority, [["Estudiante",1],["Profesor",2],["Administrador",3]])%>
  </p>
  <p>
    <%= f.label :confirmation, "Confirmado" %><br />
    <%= f.select (:confirmation, [["Aceptado",true],["Pendiente",false]])%>
  </p>
  <p>
    <%= f.label :locked, "Estado de cuenta" %><br />
    <%= f.select (:locked, [["Bloqueado",true],["Desbloqueado",false]])%>
  </p>
  <%end%>

  <div class="actions">
    <%= f.submit "Enviar" %>
  </div>

<% end %>
